<!DOCTYPE html>
<html lang="en" class="no-js" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="layout">
<head>
<title>订单编辑</title>
<style type="text/css">
	#form_orderInfo label.error{
		margin-left:10px;
		width:auto;
		display:inline;
		color:red;
	}
</style>
</head>
<body>
<div layout:fragment="content">
<script th:inline="javascript">
/*<![CDATA[*/
    $.validator.addMethod('decimalScal',function(value,element){
    		if(value.split('.').length>2){
    			return false;
    		}
    		if(value.indexOf('.') != -1){
				var length = value.slice(value.indexOf('.')).length;
				if(length>3){
					return false;
				}else{
					return true;
				}
    		}
    		return true;
		},'运费尾数最多两位');
	$().ready(function() {
		$('#form_orderInfo').validate({
			rules:{
				freightAmount:{
					min:0,
					max:99999999.99,
					decimalScal:true,
					required:true
				}
			},
			messages:{
				freightAmount:{
					min:'运费最小值为0且必须为数字',
					max:'运费最大值为99999999.99且必须为数字',
					decimalScal:'运费尾数最多两位',
					required:'运费必须填写,若无请填写0'
				}
			}
		});
	});
	/*]]>*/
</script>
	<div class="row">
		<div class="col-md-12">
			<div class="btn-group pull-right">
				<a th:href="${'/orderInfo/view/'+orderInfo.id+'/'+page+'/'+viewState}" id="link_cancel" name="link_cancel" class="btn green">返回<i class="fa fa-arrow-circle-o-left"></i></a>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-md-12">
			<div class="form">
				<form role="form" id="form_orderInfo" name="form_orderInfo" th:action="@{'/orderInfo/save/'+${page}+'/'+${viewState}}" th:object="${orderInfo}" method="post" class="form-horizontal">
					<h4 class="form-section">编辑订单</h4>
					<input type="hidden" th:field="*{id}" />
                    <input type="hidden" th:field="*{isParent}"/>
					<div class="form-body">
                        <div th:if="*{isParent}">
                            <div th:if="*{(paymentStatus.description != '已付款') &amp;&amp; (orderStatus.description == '未确认' || orderStatus.description == '已确认')}" class="form-group" th:class="${#fields.hasErrors('freightAmount')}? 'form-group has-error' : 'form-group'">
                                <label class="control-label col-md-3">运费<span class="required" aria-required="true">* </span></label>
                                <div class="col-md-4">
                                    <input type="text" id="text_freightAmount"  name="text_freightAmount" class="form-control" placeholder="运费" th:field="*{freightAmount}"/>
                                    <span class="help-block" th:if="${#fields.hasErrors('freightAmount')}" th:errors="*{freightAmount}">运费必须大于等于0</span>
                                </div>
                            </div>
                        </div>
                        <div th:if="*{not isParent}">
                            <div th:if="*{(parentOrder.paymentStatus.description != '已付款')&amp;&amp; (parentOrder.orderStatus.description == '未确认' || parentOrder.orderStatus.description == '已确认')}" class="form-group" th:class="${#fields.hasErrors('freightAmount')}? 'form-group has-error' : 'form-group'">
                                <label class="control-label col-md-3">运费<span class="required" aria-required="true">* </span></label>
                                <div class="col-md-4">
                                    <input type="text" id="text_freightAmount"  name="text_freightAmount" class="form-control" placeholder="运费" th:field="*{freightAmount}"/>
                                    <span class="help-block" th:if="${#fields.hasErrors('freightAmount')}" th:errors="*{freightAmount}">运费必须大于等于0</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-3">客服备注</label>
                            <div class="col-md-4">
                                <textarea row="3" id="serviceNote" name="serviceNote" class="form-control" placeholder="客服备注" th:field="*{serviceNote}" ></textarea>
                                <span class="help-block"></span>
                            </div>
                        </div>
					</div>
					<div class="form-actions fluid">
						<div class="col-md-offset-3 col-md-9">
							<button type="submit" id="bt_submit" name="bt_submit" class="btn blue">提交</button>
						</div>
					</div>
				</form>		
			</div>
		</div>
	</div>
</div>	
</body>
</html>